﻿using System;

namespace King.Learn.DoNet.CSharp11.Example
{
    public interface IFoo
    {
        /// <summary>
        /// 静态抽象方法
        /// </summary>
        /// <returns></returns>
        static abstract int Foo1();

        /// <summary>
        /// 静态虚方法
        /// </summary>
        /// <returns></returns>
        static virtual int Foo2()
        {
            return 42;
        }
    }

    public struct Bar : IFoo
    {
        /// <summary>
        /// 隐式实现接口方法，默认调用隐式实现
        /// </summary>
        /// <returns></returns>
        public static int Foo1()
        {
            return 7;
        }

        /// <summary>
        /// 显式实现接口静态方法
        /// </summary>
        /// <returns></returns>
        static int IFoo.Foo1()
        {
            return 70;
        }
    }

    public interface IA
    {
        /// <summary>
        /// 静态虚方法
        /// </summary>
        /// <returns></returns>
        static virtual int Foo()
        {
            return 1;
        }
    }

    public interface IB
    {
        /// <summary>
        /// 静态虚方法
        /// </summary>
        /// <returns></returns>
        static virtual int Foo()
        {
            return 2;
        }
    }

    public interface IC : IA, IB
    {
        /// <summary>
        /// 显式实现接口的静态虚方法
        /// </summary>
        /// <returns></returns>
        static int IA.Foo() { return 3; }

        static int IB.Foo() { return 4; }
    }

    internal struct Bar1 : IC
    {
        public static int Foo()
        {
            return 5;
        }
    }

    internal struct Bar2 : IC
    {
        static int IA.Foo()
        {
            return 6;
        }
    }

    internal struct Bar3 : IC
    {
        static int IB.Foo()
        {
            return 7;
        }
    }

    internal struct Bar4 : IA, IB
    {
    }
}